package org.lookahead.parent.common.constant;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Schema(description = "客户端枚举")
@AllArgsConstructor
@Getter
public enum AuthClientEnum {

    LOOKAHEAD("lookahead", "la_client", 86400L, 2592000L),
    STUDENT("student", "la_client", 1296000L, 2592000L),
    SCHOOL("school", "la_client", 86400L, 2592000L),
    COURSEWARE("courseware", "la_client", 86400L, 2592000L),
    ;

    @Schema(description = "客户端Id")
    private final String clientId;

    @Schema(description = "客户端秘钥")
    private final String clientSecret;

    @Schema(description = "accessToken有效期")
    private final Long accessTokenValidity;

    @Schema(description = "refreshToken有效期")
    private final Long refreshTokenValidity;

    public static AuthClientEnum getByClientId(String clientId) {
        for (AuthClientEnum authClientEnum : AuthClientEnum.values()) {
            if (authClientEnum.getClientId().equals(clientId)) {
                return authClientEnum;
            }
        }
        return null;
    }
}
